import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { RbacPermission } from "./rbac_permission.entity";

@Entity()
export class RbacRole {
    @PrimaryGeneratedColumn()
    id: number

    @Column({
        length: 20
    })
    name: string

    @CreateDateColumn()
    createTime: Date

    @UpdateDateColumn()
    updateTime: Date

    @ManyToMany(() => RbacPermission)
    @JoinTable({
        name: 'rbac_role_permission_relation'
    })
    permissions: RbacPermission[]

}